package testcase.validationtest;

import validation.Type;
import validation.TrioWithSolo;
import card.*;
import junit.framework.TestCase;

public class TrioWithSoloTest extends TestCase {
	private Type trioWithSolo;
	private Cardset cardset;
	/**
	* Sets up the test fixture.
	*
	* Called before every test case method.
	*/
	public void setUp() { 
		cardset = new Cardset(4);
		trioWithSolo = TrioWithSolo.getInstance();
	}
	
	/**
	* Tears down the test fixture.
	*
	* Called after every test case method.
	*/
	public void tearDown() {
		trioWithSolo.clear();
		trioWithSolo = null;
	}
	
	//Test case 1
	public void  testIdentifyCorrectCombination_1() {
		cardset.add(new Card('h', '3'));
		cardset.add(new Card('s', '3'));
		cardset.add(new Card('c', '3'));
		cardset.add(new Card('c', 'B'));
		Type result = trioWithSolo.identify(cardset);
		assertEquals(result, trioWithSolo);
	}
	
	//Test case 2
	public void  testIdentifyCorrectCombination_2() {
		cardset.add(new Card('h', '2'));
		cardset.add(new Card('s', '2'));
		cardset.add(new Card('c', '2'));
		cardset.add(new Card('c', '4'));
		Type result = trioWithSolo.identify(cardset);
		assertEquals(result, trioWithSolo);
	}
	
	//Test case 3
	public void  testIdentifyCorrectCombination_3() {
		cardset.add(new Card('h', 'A'));
		cardset.add(new Card('s', 'A'));
		cardset.add(new Card('c', 'A'));
		cardset.add(new Card('c', '7'));
		Type result = trioWithSolo.identify(cardset);
		assertEquals(result, trioWithSolo);
	}
	
	//Test case 4
	public void  testIdentifyIncorrectCombination_1() {
		cardset.add(new Card('d', '9'));
		cardset.add(new Card('c', '9'));
		cardset.add(new Card('s', '4'));
		cardset.add(new Card('h', '4'));
		Type result = trioWithSolo.identify(cardset);
		assertEquals(result, null);
	}
	
	//Test case 5
	public void  testIdentifyIncorrectCombination_2() {
		cardset.add(new Card('d', 'A'));
		cardset.add(new Card('c', '9'));
		cardset.add(new Card('s', '4'));
		cardset.add(new Card('h', '4'));
		Type result = trioWithSolo.identify(cardset);
		assertEquals(result, null);
	}
	
	//Test case 6
	public void  testIdentifyIncorrectCombination_3() {
		cardset.add(new Card('d', 'A'));
		cardset.add(new Card('c', '9'));
		cardset.add(new Card('s', '5'));
		cardset.add(new Card('h', '4'));
		Type result = trioWithSolo.identify(cardset);
		assertEquals(result, null);
	}
	
	//Test case 7
	public void  testIdentifyIncorrectCombination_4() {
		cardset.add(new Card('d', '2'));
		cardset.add(new Card('c', '2'));
		cardset.add(new Card('s', '2'));
		cardset.add(new Card('h', '2'));
		Type result = trioWithSolo.identify(cardset);
		assertEquals(result, null);
	}
	
	//Test case 7
	public void  testForInsufficientCards() {
		cardset.add(new Card('c', 'X'));
		cardset.add(new Card('d', 'X'));
		cardset.add(new Card('s', 'X'));
		Type result = trioWithSolo.identify(cardset);
		assertEquals(result, null);
	}
	
	//Test case 8
	public void  testPriority_1() {
		cardset.add(new Card('h', '5'));
		cardset.add(new Card('s', '5'));
		cardset.add(new Card('d', '5'));
		cardset.add(new Card('d', 'R'));
		Cardset temp = new Cardset(4);
		temp.add(new Card('s', '6'));
		temp.add(new Card('d', '6'));
		temp.add(new Card('c', '6'));
		temp.add(new Card('c', '7'));
		trioWithSolo.lessPriorityThan(cardset);
		boolean result = trioWithSolo.lessPriorityThan(temp);
		assertEquals(result, true);
	}	

	//Test case 9
	public void  testPriority_2() {
		cardset.add(new Card('h', 'Q'));
		cardset.add(new Card('s', 'Q'));
		cardset.add(new Card('d', 'Q'));
		cardset.add(new Card('d', '4'));
		Cardset temp = new Cardset(4);
		temp.add(new Card('s', 'A'));
		temp.add(new Card('d', 'A'));
		temp.add(new Card('c', 'A'));
		temp.add(new Card('d', 'X'));
		trioWithSolo.lessPriorityThan(cardset);
		boolean result = trioWithSolo.lessPriorityThan(temp);
		assertEquals(result, true);
	}
	
	//Test case 10
	public void  testPriority_3() {
		cardset.add(new Card('h', '2'));
		cardset.add(new Card('s', '2'));
		cardset.add(new Card('d', '2'));
		cardset.add(new Card('h', 'K'));
		Cardset temp = new Cardset(4);
		temp.add(new Card('s', 'K'));
		temp.add(new Card('d', 'K'));
		temp.add(new Card('c', 'K'));
		temp.add(new Card('c', '2'));
		trioWithSolo.lessPriorityThan(cardset);
		boolean result = trioWithSolo.lessPriorityThan(temp);
		assertEquals(result, false);
	}
	
	//Test case 11
	public void  testPriority_4() {
		cardset.add(new Card('h', 'J'));
		cardset.add(new Card('s', 'J'));
		cardset.add(new Card('d', 'J'));
		cardset.add(new Card('h', '6'));
		Cardset temp = new Cardset(4);
		temp.add(new Card('s', '5'));
		temp.add(new Card('d', '5'));
		temp.add(new Card('c', '5'));
		temp.add(new Card('c', '6'));
		trioWithSolo.lessPriorityThan(cardset);
		boolean result = trioWithSolo.lessPriorityThan(temp);
		assertEquals(result, false);
	}
}
